/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1619775565265_9718';

  // add your middleware config here
  config.middleware = [];


  config.security = {
    csrf: {
      enable: false,
      ignoreJSON: true,
    },
  };

  config.cors = {
    origin: '*',
    allowMethods: 'POST',
  };

  // swagger
  config.swaggerdoc = {
    dirScanner: './app/controller',
    apiInfo: {
      title: 'app_srv APP挂号接口',
      description: '对外提供挂号接口 呼伦贝尔市卫健委 医疗卫生信息互联互通平台使用',
      version: '1.0.0',
    },
    schemes: [ 'http' ],
    // 配置接口安全授权方式
    // securityDefinitions: {
    //   apiKey: {
    //     description: 'Authorization format : Bearer {token}',
    //     type: 'apiKey',
    //     name: 'authorization',
    //     in: 'header',
    //   },
    // },
    // enableSecurity: true,
    enable: true,
  };

  config.mysql = {
    // database configuration
    client: {
      // host
      host: '50.168.1.211',
      // port
      port: '3306',
      // username
      user: 'root',
      // password
      password: 'admin@123',
      // database
      database: 'db_appsrv',
    },
    // load into app,default is open //加载到应用程序，默认为打开
    app: true,
    // load into agent,default is close //加载到代理中，默认值为“关闭”
    agent: false,
  };

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  return {
    ...config,
    ...userConfig,
  };
};
